<template>
  <div class="flights-aside">
    <div class="statement">
      <el-row type="flex" justify="space-between" class="statement-list">
        <el-col :span="8">
          <i
            class="iconfont iconweibiaoti-_huabanfuben"
            style="color: #409eff"
          ></i>
          <span>航协认证</span>
        </el-col>
        <el-col :span="8">
          <i class="iconfont iconbaozheng" style="color: green"></i>
          <span>出行保证</span>
        </el-col>
        <el-col :span="8">
          <i class="iconfont icondianhua" style="color: #409eff"></i>
          <span>7x24</span>
        </el-col>
      </el-row>
      <p class="service-tel">免费客服电话：4006345678转2</p>
    </div>
    <!-- 使用vuex保持历史查询记录 -->
    <div class="history">
      <h5>历史查询</h5>
      <nuxt-link
        v-for="(item, index) in $store.state.history.flightRecord"
        :key="index"
        :to="`/air/flights?departCity=${item.departCity}&departCode=${item.departCode}&destCity=${item.destCity}&destCode=${item.destCode}&departDate=${item.departDate}`"
        @click="console.log(this.$store.state.history.flightRecord);"
      >
        <el-row
          type="flex"
          justify="space-between"
          align="middle"
          class="history-item"
        >
          <div class="air-info">
            <div class="to-from">
              {{ item.departCity }} - {{ item.destCity }}
              <p>
                {{ item.departDate }}
              </p>
            </div>
          </div>
          <span>选择</span>
        </el-row>
      </nuxt-link>
    </div>
  </div>
</template>

<script>
export default {
  mounted () {
    console.log(this.$store.state.history.flightRecord);
  }
};
</script>

<style lang="less" scoped>
.statement {
  border: 1px #ddd solid;

  .statement-list {
    padding: 10px 0;
    > div {
      text-align: center;
      i {
        display: block;
        font-size: 40px;
      }
      span {
        font-size: 12px;
      }
    }
  }
  .service-tel {
    height: 32px;
    line-height: 32px;
    padding: 0 10px;
    background: #f6f6f6;
    font-size: 14px;
  }
}

.history {
  border: 1px #ddd solid;
  padding: 10px;
  margin-top: 10px;
  h5 {
    font-weight: normal;
    font-size: 18px;
    border-bottom: 1px solid #f5f5f5;
    padding-bottom: 5px;
  }
  a {
    display: block;
    text-decoration: none;
    color: #000;
    padding: 4px 0;
    .history-item {
      padding: 10px 0;
      font-size: 14px;
      border-bottom: 1px #eee solid;
      cursor: pointer;
      &:last-child {
        border: none;
      }
      .air-info {
        .to-from {
          margin-bottom: 5px;
        }
        p {
          font-size: 12px;
          color: #666;
        }
      }
      span {
        display: block;
        padding: 2px 10px;
        background: orange;
        color: #fff;
        font-size: 12px;
        border-radius: 4px;
        cursor: pointer;
      }
    }
  }
}
</style>